        
<!--For 单选框、复选框、下拉框-->
<template>

          <el-form ref="form" :model="selectedCom" label-width="80px" style="margin-top:20px;position:relative">
          <el-form-item label="整体布局">
            <el-select v-model="selectedCom.layoutOption" placeholder="请选择">
              <el-option
              v-for="item in layoutOptions"
              :key="item"
              :label="item"
              :value="item">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="label名称">
            <el-input v-model="selectedCom.labelName"></el-input>
          </el-form-item>
          <el-form-item label="label布局" v-if="selectedCom.labelLayout!=''">
             <el-select v-model="selectedCom.labelLayout" placeholder="请选择">
              <el-option
              v-for="item in layoutOptions"
              :key="item"
              :label="item"
              :value="item">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="控件布局"  v-if="selectedCom.contentLayout!=''">
             <el-select v-model="selectedCom.contentLayout" placeholder="请选择">
              <el-option
              v-for="item in layoutOptions"
              :key="item"
              :label="item"
              :value="item">
              </el-option>
            </el-select>
          </el-form-item>
          <el-row>
            <el-tag
              :key="tag"
              v-for="tag in dynamicOptions"
              closable
              :disable-transitions="false"
              @close="handleClose(tag)">
              {{tag}}
            </el-tag>
            <el-input
              class="input-new-tag"
              v-if="inputVisible"
              v-model="inputValue"
              ref="saveTagInput"
              size="small"
              @keyup.enter.native="handleInputConfirm"
              @blur="handleInputConfirm">
            </el-input>
            <el-button v-else class="button-new-tag" size="small" @click="showInput">+ Add</el-button>
          </el-row>
            
        </el-form>
</template>

<script>
export default {
  data() {
    return {
      inputVisible: false,
      inputValue: "",
      layoutOptions: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
    };
  },
  methods: {
    //选项按钮编辑
    handleClose(tag) {
      this.dynamicOptions.splice(this.dynamicOptions.indexOf(tag), 1);
    },

    showInput() {
      this.inputVisible = true;
      this.$nextTick(_ => {
        this.$refs.saveTagInput.$refs.input.focus();
      });
    },

    handleInputConfirm() {
      let inputValue = this.inputValue;
      if (inputValue) {
        this.dynamicOptions.push(inputValue);
      }
      this.inputVisible = false;
      this.inputValue = "";
    }
  },
  props: {
    selectedCom: Object,
    dynamicOptions: Array
  }
};
</script>
